<template>
  <el-select v-model="bizType" placeholder="请选择业务类型" clearable :disabled="disabled" class="!w-240px">
    <el-option
      v-for="bizType in bizTypeOptions"
      :key="bizType.id"
      :label="bizType.name"
      :value="bizType.id"
    />
  </el-select>  
</template>
<script lang="ts" setup>
import * as ChamberApi from '@/api/chamber'

/** 会员分组选择框 **/
defineOptions({ name: 'BizTypeSelect' })

const props = defineProps({
  /** 下拉框选中值 **/
  modelValue: {
    type: Number,
    default: undefined
  },
  /** 是否禁用 **/
  disabled: {
    type: Boolean,
    default: false
  },
})
const emit = defineEmits(['update:modelValue'])

const bizType = computed({
  get() {
    return props.modelValue
  },
  set(value: any) {
    emit('update:modelValue', value)
  }
})

const bizTypeOptions = ref([])

const getList = async () => {
  bizTypeOptions.value = await ChamberApi.getMemberPointBizTypeList()
}

/** 初始化 */
onMounted(() => {
  getList()
})
</script>
